local hashkey =""
local models = {
	{model = 581, file = 'bf400',},
};

local function replace(id,file)
	local fN = split(file, ',');
	if File.exists('pojazdy/'..file..'.tPSSM') then
		local raw = File('pojazdy/'..file..'.tPSSM', true);
		local rawData = raw:read(raw.size);
		local rawData = rawData:gsub(hashkey,'');
		EngineTXD(rawData):import(id);
		raw:close();
		raw,rawData = nil,nil;
	end
	if File.exists('pojazdy/'..file..'.dPSSM') then
		local raw = File('pojazdy/'..file..'.dPSSM', true);
		local rawData = raw:read(raw.size);
		local rawData = rawData:gsub(hashkey,'');
		EngineDFF(rawData):replace(id);
		raw:close();
		raw,rawData = nil,nil;
	end
end


addEvent("dataDecode",true)
addEventHandler("dataDecode",localPlayer,function(key --[[,arr]])

	hashkey = key
	--models = arr
	for k,v in pairs(models) do
		replace(v.model, v.file);
	end

end)

addEventHandler('onClientResourceStart', resourceRoot,function()
	triggerLatentServerEvent("queryDataDecode",resourceRoot)
end);